<?php

namespace app\common\service;

use GatewayWorker\Lib\Gateway;

/**
 * WebSocket服务
 * Class WebSocket
 * @package app\common\service
 * @author Leo.lei <346991581@qq.com>
 * @date 2020/1/25 22:26
 */
class WebSocket
{
    /**
     * init
     */
    protected static function init()
    {
        Gateway::$registerAddress = '127.0.0.1:1236';
    }

    /**
     * sendToAll
     * @param string $data
     * @throws \Exception
     */
    public static function sendToAll(string $data)
    {
        self::init();
        Gateway::sendToAll($data);
    }
}